package com.tbit.uqbike.service.business;


import com.tbit.uqbike.object.pojo.*;
import com.tbit.common.entity.view.Result;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 骑行日志service
 *
 * @author Leon
 * 2017年2月24日 下午4:09:17
 */
public interface RideLogService {

    /**
     * 查询总数
     *
     * @return
     */
    Integer queryCount(List<Integer> userIds, Integer machineId, List<Integer> adAccountIdList, String orderNo);

    /**
     * 分页查询
     *
     * @return
     */
    List<RideLog> queryPage(List<Integer> userIds, Integer machineId, Integer rowCount, Integer pageNO, String sortName, List<Integer> adAccountIdList, String orderNo);

    /**
     * 更新
     *
     * @param rideLog
     */
    void update(RideLog rideLog);

    /**
     * 修改支付时间
     *
     * @param rideLog
     */
    void updatePayTime(RideLog rideLog);

    RideLog getByOrderNO(String orderNO);

    /**
     * 站点统计
     */
    List<StatPark> statByPark(Integer accountId, Integer type, Long startTime, Long endTime, Integer pageNO, Integer rowCount, List<Integer> regionIdList, Integer changeType);

    /**
     * 站点统计总数
     */
    Integer statByParkCount(Integer accountId, Integer type, Long startTime, Long endTime, List<Integer> regionIdList, Integer changeType);

    /**
     * 订单统计
     */
    List<StatPark> statRecharge(Integer accountId, Long startTime, Long endTime);

    /**
     * 订单按天统计折线图数据
     */
    List<StatPark> statLineChart(Integer accountId, Long startTime, Long endTime, String regionIds, Integer type, Boolean sort);

    /**
     * 根据设备id查询骑行订单
     */
    List<MachineRideLog> getByMachineId(Integer machineId, String phone, String orderNo, Integer rowCount, Integer pageNO);

    /**
     * 通过userId查询订单记录
     *
     * @param userId        用户id
     * @param orderNo       订单号
     * @param accountIdList 运营区域id集合
     */
    List<MachineRideLog> getByUserId(Integer userId, String orderNo, List<Integer> accountIdList);


    /**
     * 总数
     */
    Integer getByMachineIdCount(Integer machineId, String phone, String orderNo);

    /**
     * 订单查询详细分页
     */
    List<RideLog> rechargeQueryPage(HashMap<String, Object> stringObjectHashMap, Integer accountId, Integer type, Long startTime, Long endTime, String phone, String userCode, String orderNO, Integer pageNO, Integer rowCount, Role role, List<Integer> regionList, Integer timeType, Integer ridingTimeMoreThan);

    /**
     * 订单查询总数
     */
    Integer rechargeQueryCount(HashMap<String, Object> stringObjectHashMap, Integer accountId, Integer type, Long startTime, Long endTime, String phone, String userCode, String orderNO, Role role, List<Integer> regionList, Integer timeType, Integer ridingTimeMoreThan);

    /**
     * 骑行订单按天统计或按月统计
     */
    List<StatPark> statByType(List<Integer> accountIds, String startTime, String endTime, Integer type);

    List<StatPark> statByTypeByRegionId(List<Integer> accountIds, String startTime, String endTime, Integer type, List<Integer> regionIdsList, Boolean sort);


    /**
     * 统计订单总收入
     */
    MoneyData statMoney(Integer accountId, Integer orderPayType, Integer timeType, Long startTime, Long endTime);

    /**
     * 订单查询详细分页
     */
    List<RideLog> userPage(Integer accountId, Integer orderPayType, Integer timeType, Long startTime, Long endTime, Integer pageNO, Integer rowCount);

    /**
     * 订单查询总数
     */
    Integer userCount(Integer accountId, Integer orderPayType, Integer timeType, Long startTime, Long endTime);

    /**
     * 订单查询详细分页
     */
    List<RideLog> userExport(Integer accountId, Integer orderPayType, Integer timeType, Long startTime, Long endTime);

    List<Map<String, Object>> getRideRank(RideLog rideLog);

    /**
     * 订单金额修改
     */
    void updateRidelog(RideLog rideLog);

    List<Map<String, Object>> ridelogByDay(Integer accountId, Long startTime, Long endTime, List<Integer> regionList);

    List<Map<String, Object>> arrearsStatistics(RideLog rideLog, boolean b);

    List<Map<String, Object>> statOrderByPark(HashMap<String, Object> params, Integer accountId, String name, String orderNO, Integer userCode, String phone, Integer type, Long startTime, Long endTime);

    String rideLogCsvExportCsv(Integer accountId, Integer type, Long startTime, Long endTime, String phone, String userCode, String orderNO, Role role, List<Integer> regionList, Integer timeType, Integer ridingTimeMoreThan);

    /**
     * 根据车辆编号查询最近骑行用户
     *
     * @param machineId 用户码
     * @param accountId 运营区域id
     * @param pageNO    页码
     * @param rowCount  条数
     * @return List<RideLog>
     */
    List<RideLog> getRecentUser(Integer machineId, Integer accountId, Integer pageNO, Integer rowCount);

    Result<Object> rideLogCsvExport(Integer accountId, Integer type, Long startTime, Long endTime, String phone, String userCode, String orderNO, Role role, List<Integer> regionList, Integer timeType, Integer ridingTimeMoreThan);

    /**
     * 根据用户id和运营区查询最近一笔骑行订单
     *
     * @param userId 用户码
     * @param accountIdList 运营区域id
     */
    Account getAccountByUserOrder(Integer userId, List<Integer> accountIdList);
}